/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sunspotworld;

/**
 *
 * @author me
 */
public class Spender extends Thread {
    int CDELAY =55;        //ms
    int CTRIALS = 100;

    Bank bank;
    public Spender(Bank bank) {
        this.bank = bank;
    }
    public void run(){
        try
        {
           for (int i = 0; i < CTRIALS; i++)
           {
            int stuff = bank.withdraw(100);
            System.out.println("Spend #" +i);

            Thread.sleep(CDELAY);
            }
        } catch (InterruptedException e) {
        }
    }
}
